<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>polyaft</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="pol2rect.html" title="pol2rect" />
    <link rel="next" href="polynomial.html" title="polynomial" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">polyaft</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="pol2rect.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="polynomial.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="polyaft"></a>
      <div class="titlepage"></div>
      <a id="IndexPolyaft" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">polyaft</span>
        </h2>
        <p>polyaft —  
      Returns the polyphonic after-touch pressure of the selected note number.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp134998912"></a>
        <h2>Description</h2>
        <p>
      <span class="emphasis"><em>polyaft</em></span> returns the polyphonic pressure of the selected note number, optionally mapped to an user-specified range.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp135000688"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ires <span class="command"><strong>polyaft</strong></span> inote [, ilow] [, ihigh]</pre>
        <pre class="synopsis">kres <span class="command"><strong>polyaft</strong></span> inote [, ilow] [, ihigh]</pre>
      </div>
      <div class="refsect1">
        <a id="idp135004320"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>inote</em></span> -- note number. Normally set to the value returned by <a class="link" href="notnum.html" title="notnum"><em class="citetitle">notnum</em></a>
    </p>
        <p>
      <span class="emphasis"><em>ilow</em></span> (optional, default: 0) -- lowest output value
    </p>
        <p>
      <span class="emphasis"><em>ihigh</em></span> (optional, default: 127) -- highest output value
    </p>
      </div>
      <div class="refsect1">
        <a id="idp135008848"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kres</em></span> -- polyphonic pressure (aftertouch).
    </p>
      </div>
      <div class="refsect1">
        <a id="idp135010576"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the polyaft opcode. It uses the file <a class="ulink" href="examples/polyaft.csd" target="_top"><em class="citetitle">polyaft.csd</em></a>.
    </p>
        <p>
      Don't forget that you must include the <a class="link" href="CommandFlags.html#FlagsMinusUpperF"><em class="citetitle">-F flag</em></a> when using an external MIDI file like <span class="quote">“<span class="quote">polyaft.mid</span>”</span>.
    </p>
        <p>
      </p>
        <div class="example">
          <a id="idp135014672"></a>
          <p class="title">
            <strong>Example 637. Example of the polyaft opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in   No messages  MIDI in</span>
-odac           -iadc     -d         -M0  <span class="comment">;;;RT audio I/O with MIDI in</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o polyaft.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span>	<span class="op">=</span>  44100
<span class="ohdr">ksmps</span>	<span class="op">=</span>  10
<span class="ohdr">nchnls</span>	<span class="op">=</span>  1

	<span class="ohdr">massign</span> 1, 1
itmp	<span class="ohdr">ftgen</span> 1, 0, 1024, 10, 1		<span class="comment">; sine wave</span>

	<span class="oblock">instr</span> 1

kcps	<span class="opc">cpsmidib</span> 2		<span class="comment">; note frequency</span>
inote	<span class="opc">notnum</span>			<span class="comment">; note number</span>
kaft	<span class="opc">polyaft</span> inote, 0, 127	<span class="comment">; aftertouch</span>
<span class="comment">; interpolate aftertouch to eliminate clicks</span>
ktmp	<span class="opc">phasor</span> 40
ktmp	<span class="opc">trigger</span> 1 <span class="op">-</span> ktmp, 0.5, 0
kaft	<span class="opc">tlineto</span> kaft, 0.025, ktmp
<span class="comment">; map to sine curve for crossfade</span>
kaft	<span class="op">=</span>  <span class="opc">sin</span>(kaft <span class="op">*</span> 3.14159 <span class="op">/</span> 254) <span class="op">*</span> 22000

asnd	<span class="opc">oscili</span> kaft, kcps, 1

	<span class="opc">out</span> asnd

	<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">t</span> 0 120
<span class="stamnt">f</span> 0 9 2 -2 0
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp135018992"></a>
        <h2>Credits</h2>
        <p>Added thanks to an email from Istvan Varga</p>
        <p>New in version 4.12</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="pol2rect.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="polynomial.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">pol2rect </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> polynomial</td>
        </tr>
      </table>
    </div>
  </body>
</html>
